-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New markdown parser #2439
New markdown parser #2439
Conversation
… keys where required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. It's quite a small footprint for such a significant change. Love that the public interface doesn't change.
Approving, but let's not merge just yet. Would like to do one last Python3.6 release.
I realize this might be slightly out of scope of this PR, as it does not enable strikethrough extension, but I thought I'd mention it here in case it indicates an issue that is better to address now. I found that merely enabling the extension was not enough to make diff --git a/rich/markdown.py b/rich/markdown.py
index 36d6491e..3b75c579 100644
--- a/rich/markdown.py
+++ b/rich/markdown.py
@@ -427,7 +427,7 @@ class Markdown(JupyterMixin):
"image": ImageItem,
}
- inlines = {"em", "strong", "code", "strike"}
+ inlines = {"em", "strong", "code", "s"}
def __init__(
self,
@@ -439,7 +439,7 @@ class Markdown(JupyterMixin):
inline_code_lexer: Optional[str] = None,
inline_code_theme: Optional[str] = None,
) -> None:
- parser = MarkdownIt().enable("table")
+ parser = MarkdownIt().enable(["table", "strikethrough"])
self.markup = markup
self.parsed = parser.parse(markup)
self.code_theme = code_theme Furthermore, since the default theme has from rich.console import Console
from rich.theme import Theme
from rich.style import Style
our_theme = Theme({
"markdown.s": Style(strike=True),
})
console = Console(theme=our_theme) |
Hi all, considering commonmark is not being maintained anymore, are there plans to merge this PR in the near future? |
… new-markdown-parser
@synrg That's great, thanks! I've added that to this PR so that we support strikethrough (cc @willmcgugan). @daniloegea Just polishing this up now, so should be getting merged relatively soon. |
@@ -8,7 +8,7 @@ jobs: | |||
strategy: | |||
matrix: | |||
os: [windows-latest, ubuntu-latest, macos-latest] | |||
python-version: ["3.7", "3.8", "3.9", "3.10"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were missing 3.11.
Nice. This will make some folks happy. |
That's brilliant. Thanks so much! :) |
superb! many thanks |
Awesome, thank you! Will there be a new release including this change, soon? Oh, nevermind :) https://github.com/Textualize/rich/releases/tag/v13.2.0 |
Apparently commonmark is unmaintained: Textualize/rich#2439
FYI as the maintainer of markdown-it-py, I approve 😄 was wondering why there was a sudden spike in pypi downloads 😆 Love rich, keep up the good work! |
Type of changes
Checklist
Description
Work in progress.
Switches over to
markdown-it-py
instead ofcommonmark
for Markdown parsing.